home *** CD-ROM | disk | FTP | other *** search
Text File | 1999-03-21 | 1.6 KB | 63 lines | [TEXT/ttxt] |
- falseŸtrueŸfalseŸŸtrue
-
- function importFile fileName
- -- imports a file, and returns the data.
- open file fileName
- read from file fileName until end
- close file fileName
- return it
- end importFile
-
- function printData data
- -- prints the data, and returns nothing on success and error on faliure
- print data
- return the result
- end printData
-
- function getLastItemOfPath filePath
- -- returns the last item of a colon-delimitered list (like a file path)
- set itemDelimiter to ":"
- get last item of filePath
- set itemDelimiter to ","
- return it
- end getLastItemOfPath
-
- function addCommas integer
- if integer is not a number then
- return "Error: Not a number."
- exit addCommas
- end if
- set itemDelimiter to "."
- put first item of integer into beforeDecimal
- put last item of integer into afterDecimal
- put the number of chars of beforeDecimal into charNum
- if charNum ≤ 3 then
- return integer
- exit addCommas
- end if
- put 3 into i
- repeat until i ≥ charNum
- put "," after char (charNum - i) of beforeDecimal
- add 3 to i
- end repeat
- if the number of items of integer = 1 then return beforeDecimal
- else return beforeDecimal&"."&afterDecimal
- set itemDelimiter to ","
- end addCommas
-
- function findFromBytes num
- put "Bytes" into vSuff
- if num ≥ 1024 then
- put (num/1024) into num
- put "Kilobytes" into vSuff
- if num ≥ 1024 then
- put (num/1024) into num
- put "Megabytes" into vSuff
- if num ≥ 1024 then
- put (num/1024) into num
- put "Gigabytes" into vSuff
- end if
- end if
- end if
- return num&&vSuff
- end findFromBytes